package cn.lsc.openfegin;

import cn.lsc.domain.User;
import cn.lsc.feign.UserFeignService;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class UserFeignClientFallbackFactory implements FallbackFactory<UserFeignService> {

    @Override
    public UserFeignService create(Throwable throwable) {
        return new UserFeignService() {
            @Override
            public User findById(Long id) {
                return new User(-1L,"触发熔断了","服务暂时不可用！");
            }
        };
    }
}
